
<style type="text/css">
    .ui.addDimission.modal .fourWord{min-width:6em;}
    .ui.edit.modal .fourWord{min-width:6em;}
    .ui.look.modal .fourWord{min-width:4em;}
</style>
<div class="cont">
    <div class="position">
        <img alt="位置图标" src="dist/images/position.png" />系统管理&gt;离职管理
    </div>
    <div class="mybackground">
        <div class="cont_fr_top"> 
            <div class="cont_fr_btn">
                <div class="fr" style="height: 20px;">
                    <button class="cont_f_btn3" ng-click="addDimission()" >新增离职</button>                        
                </div>
            </div>
            <div class="menus">
                <div class="menus_con">
                    <div class="ui form">
                        <div class="four fields">
                            <div class="inline field">
                                <label style="min-width:5em;">工号：</label>
                                <input type="text" ng-model="search_param.number" placeholder="工号"  style="width:160px">
                            </div>
                            <div class="inline field">
                                <label style="min-width:5em;">姓名：</label>
                                <input type="text" ng-model="search_param.nickname" placeholder="姓名"  style="width:160px">
                            </div>
                            <div class="inline field">
                              <label for="textfield" >员工部门：</label>
                                <select ng-model="search_param.sector" class="ui dropdown" >
                                        <option value="-1">全部</option>
                                        <option value="{{vitem.sector_id}}" ng-repeat="vitem in sectors|tree2Arr:'_child'">{{vitem.rep}}{{vitem.sector_name}}</option>
                                </select>                       
                            </div>
                            <div class="inline field">
                                        <label>员工岗位：</label>
                                        <select ng-model="search_param.role" class="ui dropdown" >
                                                <option value="-1">全部</option>
                                                <option value="{{vitem.role_id}}" ng-repeat="vitem in roles|tree2Arr:'_child'">{{vitem.rep}}{{vitem.role_name}}</option>
                                        </select>                       
                            </div> 
                    </div>
                   <div class="four fields">
                            <div class="inline field">
                                <label for="textfield" >离职类型：</label>
                                <select ng-model="search_param.leaveType" class="ui dropdown" >
                                        <option value="-2">全部</option>
                                        <option value="{{vitem.k}}" ng-repeat="vitem in leaveType">{{vitem.v}}</option>
                                </select>   
                            </div> 
                             <div class="inline field">
                                <label>开始时间：</label>
                                <div class="ui left icon input" style="width:160px">
                                  <input  name="dimissiontime1" ng-model="search_param.dimissiontime1" placeholder="离职时间" datetimepicker format='YYYY-MM-DD' ng-keyup="$event.keyCode == 13 && search()" class="ui left icon input">
                                  <i class="calendar icon"></i>
                                </div>       
                             </div>
                             <div class="inline field">
                                <label>结束时间：</label>
                                <div class="ui left icon input" style="width:160px">
                                  <input  name="dimissiontime2" ng-model="search_param.dimissiontime2" placeholder="离职时间" datetimepicker format='YYYY-MM-DD' ng-keyup="$event.keyCode == 13 && search()" class="ui left icon input">
                                  <i class="calendar icon"></i>
                                </div>       
                             </div>
                            <div class="inline field" >
                                <label style="min-width:5em;"></label>
                                <button class="clear_btn" ng-click="search()">查询</button>
                            </div>
                        </div>
                </div>
            </div>
        </div>
    </div>
    
     <div class="menus_table">
        <table class="ui yellow celled striped table">
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>工号</th>
                    <th>部门</th>
                    <th>岗位</th>
                    <th>离职时间</th>
                    <th>离职类型</th>
                    <th>离职原因</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="vuser in userseee">
                    <td>{{vuser.ext_name}}</td>
                    <td>{{vuser.ext_yggh}}</td>
                    <td>{{vuser.sname}}</td>
                    <td>{{vuser.rname}}</td>
                    <td>{{vuser.dim_date}}</td>
                    <td>
                        <div ng-switch="vuser.dim_type">
                          <div ng-switch-when="-1">解聘</div>
                          <div ng-switch-when="1">开除 </div>
                          <div ng-switch-when="2">辞职</div>
                          <div ng-switch-when="0">其他</div>                   
                          <div ng-switch-default>辞职</div>
                        </div>
                    </td>
                   <td ng-attr-title="{{vuser.dim_reason}}" class= "ellipsis">{{vuser.dim_reason}}</td>

                    <td>  
                        <a href="javascript:void(0);" ng-click="lookDimission(vuser['dim_id']);">查看</a>&nbsp;
                       <!--  <div ng-if="vuser['dim_status']==1 && rcode==1" style="display:inline;"> -->
                                <a href="javascript:void(0);" ng-click="editDimission(vuser['dim_id']);">修改</a>&nbsp;
                                <a href="javascript:void(0);" ng-click="deleteDimission(vuser['dim_id']) ">撤销</a>&nbsp;
                   <!--      </div> -->
                    </td>
                </tr>
            </tbody>
            <tbody ng-show="rcode==2">
                <tr ng-show="!busy">
                    <td colspan="8" style="text-align:center;margin-top:10px" class="null_data">没有找到数据~~~</td>
                </tr>
            </tbody>
              <!-- <tfoot ng-if="pagerdata.pageAll>1">
            <tr>
                <th colspan="9">
                    <div class="ui pagination menu" jspagination page-object="pagerdata" page-func="getPageData"></div>
                </th>
            </tr>
        </tfoot> -->
        </table>
        <div ng-if="pagerdata.pageAll >1 && rcode==1" class="ui pagination fr menu" jspagination page-object="pagerdata" page-func="getPageData">
        </div>
    </div>
</div>
<div class="ui addDimission modal">
  <i class="close icon"></i>
  <div class="header_h4">
    添加离职
  </div>

    <div class="content">
    <form action="#" name="addfrm" id="addfrm">
      <div class="ui form">

      <div class="required field clearfix">
        <label class="label_fl fourWord">姓名</label>
        <input type="hidden" id="add_teacher" name="add_teacher" />
        <div angucomplete-alt id="add_teachername" name="nickname" style=" float:left; width:86%;" placeholder="员工姓名" pause="100" selected-object="selecteTeacher" local-data="teacherList" search-fields="ext_name" input-changed="teacherInputChanged" title-field="nickname_long"
          maxlength="12" minlength="1" input-class="form-control form-control-small" match-class="highlight" focus-first='true' focus-in="focusIn()" focus-out="focusOut()" field-required="true">
        </div>
      </div>
      <div class="three fields">
        <div class="required field">
          <label class="label_fl fourWord">离职时间</label>
            <div class="ui left icon input" style="width:160px">
              <input  name="time" ng-model="dimissionTime" placeholder="离职时间" datetimepicker format='YYYY-MM-DD' ng-keyup="$event.keyCode == 13 && search()" class="ui left icon input">
              <i class="calendar icon"></i>
          </div>
        </div>
      </div>
      <div class="three fileds">
        <div class="field required">
          <label class="label_fl fourWord">状态</label>
          <div class="ui selection dropdown">
            <input type="hidden" name="status" id='status'>
            <div class="default text">请选择离职类型</div>
            <i class="dropdown icon"></i>
            <div class="menu">
              <div class="item" data-value="{{sel.k}}" ng-repeat="sel in leaveType">{{sel.v}}</div>
            </div>
          </div>
        </div>
      </div>
      <div class="field required">
        <label class="label_fl fourWord">离职原因</label>
        <textarea rows="2" name="reson" placeholder="请填写离职原因" type="text" ng-model="reson" style="width:86%"></textarea>
      </div>
      <div class="field">
        <label class="label_fl fourWord">备注</label>
        <textarea rows="2" name="beizhu" placeholder="请填写备注" type="text" ng-model="beizhu" style="width:86%"></textarea>
      </div>
    </div>
    </form>
  </div>


  <div class="actions">
    <div class="ui blue button positive">确定</div>
    <div class="ui grey negative button">取消</div>
  </div>
</div>
<!-- 修改离职 -->
<div class="ui edit modal">
    <i class="close icon"></i>
    <div class="header_h4">
        修改离职
    </div>
    <!-- <div class="content">
        <form action="#" name="editfrm" id="editfrm">
            <input type="hidden" id="update_user_id" name="update_user_id">
            <div class="ui form">
                <div class="field" style="line-height: 32px">
                    <b>姓名：</b>
                    <span>{{nickname}}</span>
                </div>
                <div class="three fields">
                    <div class="required field">
                        <label class="label_fl">离职时间</label>
                       <div class="ui left icon input" style="width:160px">
                          <input  name="time2" ng-model="ext_leavetime" placeholder="点击填写离职时间" datetimepicker format='YYYY-MM-DD' ng-keyup="$event.keyCode == 13 && search()" class="ui left icon input">
                          <i class="calendar icon"></i>
                       </div>          
                    </div>
                </div>
                <div class="three fileds">
                    <div class="field required">
                        <label class="label_fl">状态</label>
                        <div class="ui selection dropdown" style=""  id="edit_leaveType">
                            <input type="hidden" name="edit_leaveType">
                            <div class="default text">请选择离职状态</div>
                            <i class="dropdown icon"></i>
                            <div class="menu">
                                <div class="item" data-value="{{sel.k}}" ng-repeat="sel in leaveType">{{sel.v}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="field required">
                    <label class="label_fl">离职原因</label>
                    <input type="text" name="reson" style="width:80%;"   ng-model="ext_leave_reason"  placeholder="请填写离职原因" >
                </div>
                <div class="field">
                    <label class="label_fl">备注</label>
                    <input type="text" name="beizhu"   ng-model="ext_leave_beizhu"  style="width:84%;" placeholder="请填写备注" >
                </div>
            </div>      
        </form>
    </div> -->
    <div class="content">
        <form action="#" name="editfrm" id="editfrm">
            <input type="hidden" id="update_user_id" name="update_user_id">
            <input  type = 'hidden' name="dim_id" id="dim_id"/>
            <div class="ui form">
                <div class="field clearfix">
                    <label class="label_fl fourWord"> 姓名</label>
                    <span>{{nickname}}</span>
                </div>
                <div class="three fields">
                    <div class="required field">
                        <label class="label_fl fourWord">离职时间</label>
                       <div class="ui left icon input" style="width:160px">
                          <input  name="time2" ng-model="ext_leavetime" placeholder="点击填写离职时间" datetimepicker format='YYYY-MM-DD' ng-keyup="$event.keyCode == 13 && search()" class="ui left icon input">
                          <i class="calendar icon"></i>
                       </div>
                    </div>
                </div>

                <div class="three fileds">
                    <div class="field required">
                        <label class="label_fl fourWord">状态</label>
                        <div class="ui selection dropdown" style=""  id="edit_leaveType">
                            <input type="hidden" name="edit_leaveType">
                            <div class="default text">请选择离职状态</div>
                            <i class="dropdown icon"></i>
                            <div class="menu">
                                <div class="item" data-value="{{sel.k}}" ng-repeat="sel in leaveType">{{sel.v}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="field required">
                    <label class="label_fl fourWord">离职原因</label>
                    <textarea rows="2" name="reson" placeholder="请填写离职原因" type="text" ng-model="ext_leave_reason" style="width:86%"></textarea>
                </div>
                <div class="field">
                    <label class="label_fl fourWord">备注</label>
                    <textarea rows="2" name="beizhu" placeholder="请填写备注" type="text" ng-model="ext_leave_beizhu" style="width:86%"></textarea>
                </div>
            </div>
        </form>
    </div>
    <div class="actions ">
        <div class="ui blue button positive">确定</div>
        <div class="ui grey negative button" >取消</div>
    </div>
</div>
<!-- 查看离职 -->
<div class="ui look modal">
    <i class="close icon"></i>
    <div class="header_h4">
        查看离职
    </div>
    <div class="content">
       <form class="ui form" action="#" name="viewfrm" id="viewfrm">
            <input type="hidden" id="update_user_id" name="update_user_id">
            <div class="ui form">
               <div class="field" style="line-height: 32px">
                    <b class="fourWord">姓名：</b>
                    <span>{{lookData.ext_name}}</span>
                </div>
                <div class="field" style="line-height: 32px">
                    <b>离职时间：</b>
                    <span>{{lookData.dim_date}}</span>  
                </div>
                  <div class="field clearfix" style="line-height: 32px">
                        <b style="float:left;">状态：</b>
                        <div style="float:left;" ng-switch="lookData.dim_type">
                          <span ng-switch-when="-1">解聘</span>
                          <span ng-switch-when="1">开除 </span>
                          <span ng-switch-when="2">辞职</span>
                          <span ng-switch-when="0">其他</span>                   
                        </div>
                </div>
                 <div class="field" style="line-height: 32px" >
                        <b>离职原因：</b>
                       <span> {{lookData.dim_reason}}</span>  
                 </div>
               <div class="field" style="line-height: 32px" >
                        <b>备注：</b>
                        <span>{{lookData.dim_beizhu}}</span>
               </div>
            </div>      
        </form>
    </div>
    <!-- <div class="content">
        <form class="ui form" action="#" name="viewfrm" id="viewfrm">
            <input type="hidden" id="update_user_id" name="update_user_id">
            <div class="ui form">
                <div class="inline field" style="line-height: 32px;margin:0px;">
                    <label class="fourWord">姓名 :</label>
                    <span>{{lookData.ext_name}}</span>
                </div>
                <div class="inline field" style="line-height: 32px;margin:0px;">
                    <label class="fourWord">离职时间 :</label>
                    <span>{{lookData.dim_date}}</span>
                </div>
                </div>
                     <div class="inline field" style="line-height: 32px;margin:0px;">
                        <label class="fourWord">状态 :</label>
                        <div ng-switch="lookData.dim_type">
                          <div ng-switch-when="-1">解聘</div>
                          <div ng-switch-when="1">开除 </div>
                          <div ng-switch-when="2">辞职</div>
                          <div ng-switch-when="0">其他</div>
                        </div>
                    </div>
                     <div class="inline field" style="line-height: 32px;margin:0px;" >
                        <label class="fourWord">离职原因 :</label>
                        {{lookData.dim_reason}}

                    </div>
                    <div class="inline field" style="line-height: 32px;margin:0px;" >
                        <label class="fourWord">备注 :</label>
                        {{lookData.dim_beizhu}}
                    </div>
              </form>
    </div> -->
    <div class="actions ">
        <div class="ui blue button positive">确定</div>
        <div class="ui grey negative button" >取消</div>
    </div>
</div>

<div class="ui small del modal transition" style="text-align: center;">
    <div class="header">撤销离职</div>
    <div class="content">
        <i class="huge blue help circle icon"></i>
        <p style="padding-top: 15px;">确定撤销离职？</p>
    </div>
    <div class="actions" style="text-align: center;">
      <div class="ui positive button" ng-click="cancel(remind_id)">确认</div>
      <div class="ui grey negative button ">取消</div>
    </div>
</div>
<!--成功-->
<div class="ui modal OK" style="text-align: center;">
    <div class="header center aligned">提示</div>
    <div class="content center aligned">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">{{msg}}</p>
    </div>
</div>

<!--失败-->
<div class="ui modal Fail" style="text-align: center;">
    <div class="header center aligned">提示</div>
    <div class="content center aligned">
        <i class="huge red remove circle outline icon"></i>
        <p style="padding-top: 15px;">{{msg}}</p>
    </div>
</div>
<!-- <div class="ui large modal remind" style="text-align: center;">
    <div class="header">撤销离职</div>
    <div class="content">
        <i class="huge blue help circle icon"></i>
        <p style="padding-top: 15px;">确认撤销离职吗?</p>
    </div>
    <div class="actions" style="text-align: center;">
      <div class="ui positive button" ng-click="deleteDimission();" >确定</div>
      <div class="ui grey button negative">取消</div>
    </div>
</div> -->
<script type="text/javascript">
$(function() {
    $('.ui.dropdown').dropdown();
});

$('#addfrm').form({
        on: 'blur',
        inline: true,
        fields: {
            add_teacher: {
                identifier: 'add_teacher',
                rules: [{
                    type: 'empty',
                    prompt: '员工姓名不能为空!!!'
                }]
            },
        
             time: {
                identifier: 'time',
                rules: [{
                    type: 'empty',
                    prompt: '离职时间不能为空!!!'
                }]
            },
       
         reson: {
                identifier: 'reson',
                rules: [{
                    type: 'empty',
                    prompt: '离职原因不能为空!!!'
                }]
            },
        }
    });
$('#editfrm').form({
        on: 'blur',
        inline: true,
        fields: {
            update_user_id: {
                identifier: 'update_user_id',
                rules: [{
                    type: 'empty',
                    prompt: '员工姓名不能为空!!!'
                }]
            },
        
             time2: {
                identifier: 'time2',
                rules: [{
                    type: 'empty',
                    prompt: '离职时间不能为空!!!'
                }]
            },
       
            reson: {
                identifier: 'reson',
                rules: [{
                    type: 'empty',
                    prompt: '离职原因不能为空!!!'
                }]
            },
        }
    });
function registerHiddenBlur(hiddenID, visibleID) {
    $('#' + visibleID).blur(function() {
        setTimeout(function() {
            $('#' + hiddenID).trigger('blur');
        }, 100); 
    });
}
$(function() {
    setTimeout(function() {
        /*编辑自动补全*/
        registerHiddenBlur('update_teacher', 'update_teachername_value');
    }, 500);

});

</script>